<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Kriging Library: likelihood_mle_mod Module Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<script src="../mathjax/MathJax.js">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Kriging Library
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Data&#160;Types&#160;List</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Data&#160;Types</span></a></li>
      <li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">likelihood_mle_mod Module Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="likelihood_mle_mod" -->
<p><a href="modulelikelihood__mle__mod-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">interface &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interfacelikelihood__mle__mod_1_1likelihood__mle.html">likelihood_mle</a></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">subroutine&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlikelihood__mle__mod.html#a6991b900d482b5c1d031888b74c6b6d6">likelihood_mle_func</a> (ndim, ntot, X, Y, stot, H, theta, sigmaN, logpy)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Subroutine for computing the likelihood formula for a function only Kriging model using an explicit mean function and covariance magnitude determined based on an optimality condition.  <a href="#a6991b900d482b5c1d031888b74c6b6d6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">subroutine&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlikelihood__mle__mod.html#a93cd494dae46fa7fa7a46d0d542259c5">likelihood_mle_grad</a> (ndim, ntot, X, Y, gtot, pts, dims, dY, stot, H, theta, sigmaN, sigmaNG, logpy)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Subroutine for computing the likelihood formula for a gradient-enhanced Kriging model using an explicit mean function and covariance magnitude determined based on an optimality condition.  <a href="#a93cd494dae46fa7fa7a46d0d542259c5"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock">
<p>Definition at line <a class="el" href="likelihood__mle_8f90_source.html#l00012">12</a> of file <a class="el" href="likelihood__mle_8f90_source.html">likelihood_mle.f90</a>.</p>
</div><hr/><h2>Member Function/Subroutine Documentation</h2>
<a class="anchor" id="a6991b900d482b5c1d031888b74c6b6d6"></a><!-- doxytag: member="likelihood_mle_mod::likelihood_mle_func" ref="a6991b900d482b5c1d031888b74c6b6d6" args="(ndim, ntot, X, Y, stot, H, theta, sigmaN, logpy)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">subroutine likelihood_mle_mod::likelihood_mle_func </td>
          <td>(</td>
          <td class="paramtype">integer, intent(in)&#160;</td>
          <td class="paramname"><em>ndim</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">integer, intent(in)&#160;</td>
          <td class="paramname"><em>ntot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(ndim,ntot), intent(in)&#160;</td>
          <td class="paramname"><em>X</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(ntot), intent(in)&#160;</td>
          <td class="paramname"><em>Y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">integer, intent(in)&#160;</td>
          <td class="paramname"><em>stot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(stot,ntot), intent(in)&#160;</td>
          <td class="paramname"><em>H</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(ndim), intent(in)&#160;</td>
          <td class="paramname"><em>theta</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), intent(in)&#160;</td>
          <td class="paramname"><em>sigmaN</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), intent(out)&#160;</td>
          <td class="paramname"><em>logpy</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Subroutine for computing the likelihood formula for a function only Kriging model using an explicit mean function and covariance magnitude determined based on an optimality condition. </p>
<p>The likelihood formula for a Gaussian process with explicit mean function is given by: </p>
<p class="formulaDsp">
\[ \log p(y | X; \theta) = -\frac{1}{2} (Y - H^{T} \beta)^{T} K^{-1} (Y - H^{T} \beta) - \frac{1}{2} \log \vert K \vert - \frac{N}{2} \log 2\pi \]
</p>
<p> where \(N\) is the number of training points (denoted by the argument <em>ntot</em>) The optimal regression parameters are determined by differentiation of the above equation and solving for the parameters \(\beta\) which set this derivative to zero. Based on this process, the optimal regression parameters are given by: </p>
<p class="formulaDsp">
\[ \beta = (H K^{-1} H^{T})^{-1} H K^{-1} Y \]
</p>
<p> The optimal covariance magnitude can be derived in a similar manner as the regression parameters (differentiating the likelihood formula and determining the magnitude that sets this derivative to zero). To determine this optimal magnitude, the covariance matrix should be decomposed into the magnitude and a covariance matrix with magnitude of 1. </p>
<p class="formulaDsp">
\[ K = \sigma^{2} \hat{K} \]
</p>
<p> The magnitude 1 covariance matrix includes the noise term added to the diagonal. The elements of the covariance matrix are given as: </p>
<p class="formulaDsp">
\[ \hat{K}_{i,j} = k(\vec{x}_{i}, \vec{x}_{j},\theta) + \Gamma \delta_{i,j}\]
</p>
<p> where \(\Gamma\) is the parameter specified in the argument <em>sigmaN</em> and is the assumed level of noise in the magnitude 1 covariance matrix. The parameter is hard coded and is used to ensure \( \hat{K} \) is invertable. Using this decomposition, the magnitude 1 covariance matrix can be used directly to determine the optimal regression parameters, </p>
<p class="formulaDsp">
\[ \beta = (H \hat{K}^{-1} H^{T})^{-1} H \hat{K}^{-1} Y \]
</p>
<p> as the inverse of the covariance matrix can be written as: </p>
<p class="formulaDsp">
\[ K^{-1} = \frac{1}{\sigma^{2}} \hat{K}^{-1} \]
</p>
<p> Using these definitions, the optimal covariance magnitude is given as: </p>
<p class="formulaDsp">
\[\sigma^{2} = \frac{(Y-H^{T} \beta)^{T} \hat{K}^{-1} (Y-H^{T} \beta )}{N} \]
</p>
<p>. Using this optimal covariance, the final likelihood formula can be written as: </p>
<p class="formulaDsp">
\[ \log p(y | X; \theta) = - \frac{N}{2} \log \sigma^{2} -\frac{1}{2} \log \vert \hat{K} \vert - \frac{N}{2} - \frac{N}{2} \log 2\pi \]
</p>
<p> This final formula is a function of the length scales, \(\theta\), and the noise level ratio \(\Gamma\). The optimization is performed only over the length scales and the noise level ratio is fixed throughout the optimization. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Brian Lockwood Department of Mechanical Engineering University of Wyoming </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>May 17, 2012 </dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">in)</td><td><b> ndim </b>: The dimension of the problem </td></tr>
    <tr><td class="paramname">in)</td><td><b> ntot </b>: The number of training points </td></tr>
    <tr><td class="paramname">in)</td><td><b> X </b>: Location of the training points (size=[ndimxntot]) </td></tr>
    <tr><td class="paramname">in)</td><td><b>Y </b>: Funcation values for the training points (size=[ntot]) </td></tr>
    <tr><td class="paramname">in)</td><td><b>stot </b>: Number of Terms in the regression </td></tr>
    <tr><td class="paramname">in)</td><td><b>H</b>: The collocation matrix for the regression (size=[stotxntot]) </td></tr>
    <tr><td class="paramname">in)</td><td><b> theta </b>: Length scale in each direction (size=[ndim]) </td></tr>
    <tr><td class="paramname">in)</td><td><b> sigmaN </b>: Ratio of Noise Magnitude to covariance matrix (added to diagonal of covariance matrix with magnitude of 1) </td></tr>
    <tr><td class="paramname">out)</td><td><b> logpy </b>: Natural Logarithm of the likelihood ( \( p(y | X,\theta, \sigma, \sigma_{N})\) </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="likelihood__mle_8f90_source.html#l00054">54</a> of file <a class="el" href="likelihood__mle_8f90_source.html">likelihood_mle.f90</a>.</p>

</div>
</div>
<a class="anchor" id="a93cd494dae46fa7fa7a46d0d542259c5"></a><!-- doxytag: member="likelihood_mle_mod::likelihood_mle_grad" ref="a93cd494dae46fa7fa7a46d0d542259c5" args="(ndim, ntot, X, Y, gtot, pts, dims, dY, stot, H, theta, sigmaN, sigmaNG, logpy)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">subroutine likelihood_mle_mod::likelihood_mle_grad </td>
          <td>(</td>
          <td class="paramtype">integer, intent(in)&#160;</td>
          <td class="paramname"><em>ndim</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">integer, intent(in)&#160;</td>
          <td class="paramname"><em>ntot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(ndim,ntot), intent(in)&#160;</td>
          <td class="paramname"><em>X</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(ntot), intent(in)&#160;</td>
          <td class="paramname"><em>Y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">integer, intent(in)&#160;</td>
          <td class="paramname"><em>gtot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">integer, dimension(gtot), intent(in)&#160;</td>
          <td class="paramname"><em>pts</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">integer, dimension(gtot), intent(in)&#160;</td>
          <td class="paramname"><em>dims</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(gtot), intent(in)&#160;</td>
          <td class="paramname"><em>dY</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">integer, intent(in)&#160;</td>
          <td class="paramname"><em>stot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(stot,ntot+gtot), intent(in)&#160;</td>
          <td class="paramname"><em>H</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), dimension(ndim), intent(in)&#160;</td>
          <td class="paramname"><em>theta</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), intent(in)&#160;</td>
          <td class="paramname"><em>sigmaN</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), intent(in)&#160;</td>
          <td class="paramname"><em>sigmaNG</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">real(8), intent(out)&#160;</td>
          <td class="paramname"><em>logpy</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Subroutine for computing the likelihood formula for a gradient-enhanced Kriging model using an explicit mean function and covariance magnitude determined based on an optimality condition. </p>

<p>Definition at line <a class="el" href="likelihood__mle_8f90_source.html#l00127">127</a> of file <a class="el" href="likelihood__mle_8f90_source.html">likelihood_mle.f90</a>.</p>

</div>
</div>
<hr/>The documentation for this module was generated from the following file:<ul>
<li><a class="el" href="likelihood__mle_8f90_source.html">likelihood_mle.f90</a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>
Copyright (C) 2012 Brian A. Lockwood <br>
Generated on Tue May 1 2012 17:15:55 for Kriging Library
by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer"
							 src="doxygen.png"
							 alt="doxygen"/></a>
1.7.3
</small></address>
